﻿@model PagedList<User>

<table class="footable table table-stripped table-bordered table-hover" id="footable" data-page-size="@Model.PageSize">
    <thead>
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.FamilyName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.UserName)
            </th>
            <th data-hide="phone,tablet">
                @Html.DisplayNameFor(model => model.CreateTime)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.SortNo)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Status)
            </th>
            <th data-hide="phone,tablet">
                @Html.DisplayNameFor(model => model.Memo)
            </th>
            <th data-hide="phone,tablet">操作</th>
        </tr>
    </thead>
    <tbody>
        @if (null != Model)
        {
            foreach (var item in Model)
            {
                <tr>
                    <td>
                        @Html.DisplayFor(modelItem => item.FamilyName)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.UserName)
                    </td>

                    <td>
                        @Html.DisplayFor(modelItem => item.CreateTime)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.SortNo)
                    </td>
                    <td>
                        @if (item.Status)
                        {
                            <button type="button" class="btn bg-olive btn-xs">正常</button>
                        }
                        else
                        {
                            <button type="button" class="btn bg-orange  btn-xs">禁用</button>
                        }
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Memo)
                    </td>
                    <td>
                        <button type="button" onclick="edit('@item.Id');" class="btn btn-xs btn-warning"><i class="fa fa-edit"></i>编辑</button>
                        @*<button type="button" class="btn  btn-xs btn-info btn-flat"><i class="fa fa-search"></i></button>*@
                        <button type="button" onclick="del(this,'@item.Id');" class="btn  btn-xs btn-danger"><i class="fa fa-trash-o"></i>删除</button>
                    </td>
                </tr>
            }
        }
    </tbody>
</table>
<div class="bootstrap pull-left">共 @Model.TotalPageCount 页 @Model.TotalItemCount 条记录，当前为第 @Model.CurrentPageIndex 页</div>
@Ajax.Pager(Model,
    new PagerOptions
    {
        PageIndexParameterName = "id",
        ContainerTagName = "ul",
        CssClass = "bootstrap pull-right",
        PagerItemTemplate = "<li>{0}</li>",
        CurrentPagerItemTemplate = "<li class=\"active\"><a href=\"#\">{0}</a></li>",
        DisabledPagerItemTemplate = "<li class=\"disabled\"><a>{0}</a></li>"
    },
    new MvcAjaxOptions
    {
        UpdateTargetId = "datatable",
        DataFormId = "searchForm",
        LoadingElementId = "loadingPage",
        OnBegin = "$('#datatable').fadeOut('slow')",
        OnComplete = "$('#datatable').fadeIn('slow');$('#footable').footable({ 'sort': false });"
    }
)
